<!DOCTYPE html>
<html>
  <script>
    // const num = 1
    // console.dir(num.__proto__) // Number
    // console.log(num.__proto__ === Number.prototype) // true

    // const str = "1"
    // console.dir(str.__proto__) // String
    // console.log(str.__proto__ === String.prototype) // true

    // const bool = true
    // console.dir(bool.__proto__) // Boolean
    // console.log(bool.__proto__ === Boolean.prototype) // true

    // const date = new Date()
    // console.log(date.__proto__) // Object
    // console.log(date.__proto__ === Date.prototype) // true

    // const arr = []
    // console.dir(arr.__proto__) // Array
    // console.log(arr.__proto__ === Array.prototype) // true

    // const obj = {}
    // console.dir(obj.__proto__) // Object
    // console.log(obj.__proto__ === Object.prototype) // true

    // function func() {}
    // console.dir(func.__proto__)
    // console.log(func.prototype)
    // console.log(func.prototype.constructor === func) // true
    // console.log(func.__proto__ === Function.prototype) // true

    // function Vehicle(wheel, power) {
    //   this.wheel = 4
    //   this.power = power
    // }

    // Vehicle.prototype.run = function () {
    //   console.log("I am running.")
    // }

    function Car(wheel, power, make, model, year) {
      // Vehicle.call(this, wheel, power)
      this.make = make
      this.model = model
      this.year = year
    }

    // Car.prototype = new Vehicle()

    // Car.prototype.introduce = function () {
    //   console.log(`I'm the ${this.model}. I'm from ${this.make}. I was made in ${this.year}.`)
    // }

    const beetle = new Car(4, "gas", "Volkswagen", "Beetle", 1938)

    // console.log(Car.prototype)
    console.log(Car.prototype.constructor === Car) // true
    // console.log(beetle)
    // console.log(beetle.__proto__)
    console.log(beetle.__proto__ === Car.prototype) // true
    // beetle.introduce() // I'm the Beetle. I'm from Volkswagen. I was made in 1938.

    // beetle.run()
    // beetle.introduce()

    // class Vehicle {
    //   constructor(wheel, power) {
    //     this.wheel = 4
    //     this.power = power
    //   }
    // }

    // class Car extends Vehicle {
    //   constructor(wheel, power, make, model, year) {
    //     super(wheel, power)
    //     this.make = make
    //     this.model = model
    //     this.year = year
    //   }
    // }

    // const beetle = new Car(4, "gas", "Volkswagen", "Beetle", 1938)

    // console.dir(beetle)
    // console.log(beetle.__proto__)
  </script>
</html>
